package com.enjoyor.soa.traffic.rest.efoms.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.enjoyor.soa.traffic.api.dto.efoms.DeviceWranInfoDto;
import com.enjoyor.soa.traffic.api.dto.efoms.WranTacticsInfoDto;
import com.enjoyor.soa.traffic.frame.annotation.Auth;
import com.enjoyor.soa.traffic.frame.security.bean.dto.UserDto;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IDeviceDetailInfoConsumeService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IDeviceWranInfoConsumeService;
import com.enjoyor.soa.traffic.rest.efoms.dubbo.IWranTacticsConsumeService;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Auth
@RestController
@RequestMapping({ "/deviceDetail/" })
@Api("报警策略rest接口")
@CrossOrigin
public class DeviceDetailInfoController {
	@Autowired
	private IDeviceDetailInfoConsumeService deviceDetailConsumeService;

	@GetMapping(value = { "selectDeviceDetailInfoById" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("根据编号查询设备详细信息")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String")})
	public ResultPojo selectDeviceDetailInfoById(
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			HttpServletRequest request) {
		return deviceDetailConsumeService.selectDeviceDetailInfoById(devTypeCode, devId);
	}
	
	@GetMapping(value = { "selectDeviceDetailInfoList" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询设备详细列表信息")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "key", value = "关键字（设备编号或设备名称）", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devAreaCode", value = "管辖区域编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devDeptId", value = "管理部门编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "ledType", value = "诱导类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "deviceStatus", value = "设备使用状态", paramType = "query", dataType = "String")})
	public ResultPojo selectDeviceDetailInfoList(
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "key", required = false) String key,
			@RequestParam(defaultValue = "", value = "devAreaCode", required = false) String devAreaCode,
			@RequestParam(defaultValue = "", value = "devDeptId", required = false) String devDeptId,
			@RequestParam(defaultValue = "", value = "ledType", required = false) String ledType,
			@RequestParam(defaultValue = "", value = "deviceStatus", required = false) String deviceStatus,
			HttpServletRequest request) {
		return deviceDetailConsumeService.selectDeviceDetailInfoList(devTypeCode, devId, devName, key, 
				devAreaCode, devDeptId, ledType,deviceStatus);
	}
	
	@GetMapping(value = { "selectDeviceDetailInfoPage" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询设备详细分页信息")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "key", value = "关键字（设备编号或设备名称）", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devAreaCode", value = "管辖区域编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devDeptId", value = "管理部门编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "ledType", value = "诱导类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "deviceStatus", value = "设备使用状态", paramType = "query", dataType = "String")
		})
	public ResultPojo selectDeviceDetailInfoPage(
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "key", required = false) String key,
			@RequestParam(defaultValue = "", value = "devAreaCode", required = false) String devAreaCode,
			@RequestParam(defaultValue = "", value = "devDeptId", required = false) String devDeptId,
			@RequestParam(defaultValue = "", value = "ledType", required = false) String ledType,
			@RequestParam(defaultValue = "", value = "deviceStatus", required = false) String deviceStatus,
			Page page, HttpServletRequest request) {
		return deviceDetailConsumeService.selectDeviceDetailInfoPage(devTypeCode, devId, devName, key, 
				devAreaCode, devDeptId, ledType,deviceStatus, page);
	}
	
	@GetMapping(value = { "selectVideoByPage" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("查询视频详细分页信息（包含视频组是否选中）")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "videoGroupId", value = "视频组编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "isSelect", value = "是否选中", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "key", value = "关键字（设备编号或设备名称）", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devAreaCode", value = "管辖区域编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devDeptId", value = "管理部门编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "deviceStatus", value = "设备使用状态编号", paramType = "query", dataType = "String")})
	public ResultPojo selectVideoByPage(
			@RequestParam(defaultValue = "", value = "videoGroupId", required = false) String videoGroupId,
			@RequestParam(defaultValue = "", value = "isSelect", required = false) String isSelect,
			@RequestParam(defaultValue = "", value = "devId", required = false) String devId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "key", required = false) String key,
			@RequestParam(defaultValue = "", value = "devAreaCode", required = false) String devAreaCode,
			@RequestParam(defaultValue = "", value = "devDeptId", required = false) String devDeptId,
			@RequestParam(defaultValue = "", value = "deviceStatus", required = false) String deviceStatus,
			Page page, HttpServletRequest request) {
		return deviceDetailConsumeService.selectVideoByPage(videoGroupId, isSelect, devId, devName, key, 
				devAreaCode, devDeptId,deviceStatus, page);
	}
	/**
     * 设备分页查询信息（资产管理）
     * @param devTypeCode 设备类型编号
     * @param DevId 设备编号
     * @param devName 设备名称
     * @param key 关键字（设备编号或设备名称）
     * @param devStatusCode 设备状态编号
     * @param devAreaCode 管辖区域编号
     * @param devDeptId 管理部门编号
     * @param devFactory 生成厂家
     * @param oppmDept 维修单位
     * @param repStatusCode 报修状态编号
     * @param buildBeginDate 建设开始日期
     * @param buildEndDate 建设结束日期
     * @param shelfBeginDate 质保到期开始日期
     * @param shelfEndDate 质保到期结束日期
     * @param oppmBeginDate 下次维护开始日期
     * @param oppmEndDate 下次维护结束日期
     * @return ResultPojo
     */
	@GetMapping(value = { "selectAssetDevicePage" }, produces = { "application/json; charset=UTF-8" })
	@ResponseBody
	@ApiOperation("设备分页查询信息（资产管理）")
	@ApiImplicitParams({ 
		@ApiImplicitParam(name = "devTypeCode", value = "设备类型编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "DevId", value = "设备编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devName", value = "设备名称", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "key", value = "关键字（设备编号或设备名称）", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devStatusCode", value = "设备状态编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devAreaCode", value = "管辖区域编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devDeptId", value = "管理部门编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "devFactory", value = "生成厂家", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "oppmDept", value = "维修单位", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "repStatusCode", value = "报修状态编号", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "buildBeginDate", value = "建设开始日期", paramType = "query", dataType = "String"), 
		@ApiImplicitParam(name = "buildEndDate", value = "建设结束日期", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "shelfBeginDate", value = "质保到期开始日期", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "shelfEndDate", value = "质保到期结束日期", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "oppmBeginDate", value = "下次维护开始日期", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "oppmEndDate", value = "下次维护结束日期", paramType = "query", dataType = "String"),
		@ApiImplicitParam(name = "deviceStatus", value = "设备使用状态编号", paramType = "query", dataType = "String")})
	public ResultPojo selectAssetDevicePage(
			@RequestParam(defaultValue = "", value = "devTypeCode", required = false) String devTypeCode,
			@RequestParam(defaultValue = "", value = "DevId", required = false) String DevId,
			@RequestParam(defaultValue = "", value = "devName", required = false) String devName,
			@RequestParam(defaultValue = "", value = "key", required = false) String key,
			@RequestParam(defaultValue = "", value = "devStatusCode", required = false) String devStatusCode,
			@RequestParam(defaultValue = "", value = "devAreaCode", required = false) String devAreaCode,
			@RequestParam(defaultValue = "", value = "devDeptId", required = false) String devDeptId,
			@RequestParam(defaultValue = "", value = "devFactory", required = false) String devFactory,
			@RequestParam(defaultValue = "", value = "oppmDept", required = false) String oppmDept,
			@RequestParam(defaultValue = "", value = "repStatusCode", required = false) String repStatusCode,
			@RequestParam(defaultValue = "", value = "buildBeginDate", required = false) String buildBeginDate,
			@RequestParam(defaultValue = "", value = "buildEndDate", required = false) String buildEndDate,
			@RequestParam(defaultValue = "", value = "shelfBeginDate", required = false) String shelfBeginDate,
			@RequestParam(defaultValue = "", value = "shelfEndDate", required = false) String shelfEndDate,
			@RequestParam(defaultValue = "", value = "oppmBeginDate", required = false) String oppmBeginDate,
			@RequestParam(defaultValue = "", value = "oppmEndDate", required = false) String oppmEndDate,
			@RequestParam(defaultValue = "", value = "oppmEndDate", required = false) String deviceStatus,
			Page page, HttpServletRequest request) {
		return deviceDetailConsumeService.selectAssetDevicePage(devTypeCode, DevId, devName, key, devStatusCode, 
				devAreaCode, devDeptId, devFactory, oppmDept, repStatusCode, buildBeginDate, buildEndDate, 
				shelfBeginDate, shelfEndDate, oppmBeginDate, oppmEndDate,deviceStatus,page);
	}
}
